********************************************************************************
********************* Descriptives party level *********************************
******************************************************************************** 

use "combined_means_2017.dta", clear


* FIGURE A1: plot positions of German parties from CHES 2017 
	egen cult_dim=rowmean(galtan galtan_new immigrate_policy multiculturalism) if galtan!=. & immigrate_policy!=. & multiculturalism!=.
			label variable cult_dim "cultural dimension (GALTAN, migration and multiculturalism)"
			label variable lrecon "economic dimension"
			label variable immigrate_policy "position on migration policy"
			
			replace party="Greens" if party=="Grunen"
			replace party="The Left" if party=="Linke"
			
			twoway (scatter cult_dim lrecon if party_id==301 , mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
			(scatter cult_dim lrecon if party_id==308, mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
			(scatter cult_dim lrecon if party_id==302, mlabel(party) mlabangle(45) msymbol(D) mcolor(red) mlabcolor(red))	/// 
			(scatter cult_dim lrecon if party_id==303, mlabel(party) mlabangle(45) msymbol(D) mcolor(sand) mlabcolor(sand)) ///	
			(scatter cult_dim lrecon if party_id==304, mlabel(party) mlabangle(45) msymbol(D) mcolor(green) mlabcolor(green)) ///
			(scatter cult_dim lrecon if party_id==306, mlabel(party) mlabangle(45) msymbol(D) mcolor(purple) mlabcolor(purple)) ///
			(scatter cult_dim lrecon if party_id==310, mlabel(party) mlabangle(45) msymbol(D) mcolor(blue) mlabcolor(blue)), ///
			ylabel(0 "libertarian" 1 2 3 4 5 6 7 8 9 10 "authoritarian", angle(forty_five)) xlabel(0 "left" 1 2 3 4 5 6 7 8 9  10 "right", angle(forty_five)) ///
				xline(5) yline(5) legend(off) xsize(5) xtitle(Position on economic dimension) ytitle(Position on cultural dimension: GAL/TAN) scheme(plottig) name(DEU2017_CHESb, replace) nodraw
				
			twoway (scatter immigrate_policy lrecon if party_id==301 , mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
			(scatter immigrate_policy lrecon if party_id==308, mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
			(scatter immigrate_policy lrecon if party_id==302, mlabel(party) mlabangle(45) msymbol(D) mcolor(red) mlabcolor(red))	/// 
			(scatter immigrate_policy lrecon if party_id==303, mlabel(party) mlabangle(45) msymbol(D) mcolor(sand) mlabcolor(sand)) ///	
			(scatter immigrate_policy lrecon if party_id==304, mlabel(party) mlabangle(45) msymbol(D) mcolor(green) mlabcolor(green)) ///
			(scatter immigrate_policy lrecon if party_id==306, mlabel(party) mlabangle(45) msymbol(D) mcolor(purple) mlabcolor(purple)) ///
			(scatter immigrate_policy lrecon if party_id==310, mlabel(party) mlabangle(45) msymbol(D) mcolor(blue) mlabcolor(blue)), ///
				ylabel(0 "open" 1 2 3 4 5 6 7 8 9 10 "restrictive", angle(forty_five)) xlabel(0 "left" 1 2 3 4 5 6 7 8 9  10 "right", angle(forty_five)) /// 
				xline(5) yline(5) xsize(5) legend(off) xtitle(Position on economic dimension) ytitle(Position on immigration policy) scheme(plottig) name(DEU2017_CHESa, replace) nodraw

			graph combine DEU2017_CHESa DEU2017_CHESb, rows(1) xsize(9) iscale(1.1) imargin(vsmall) scheme(plottig) name(FigureA1, replace)
		
		
* FIGURE A2: plot clarity by German parties from CHES 2017 

	* means with CIs from expert-level dataset
			use "combined_experts_2017.dta", clear
					replace party="Greens" if party=="Grunen"
					replace party="The Left" if party=="Linke"

			ciplot lrecon_clear if country==3 & party!="LKR" & party!="BLAU", by(party) horizontal ///
					xlabel(0 "not at all clear" 1 " " 2 3 4 5 6 7 8 9 " " 10 "compl. clear") ytitle("") note(" ") xtitle(Clarity of economic left-right position) name(gr1a, replace) nodraw
			ciplot galtan_new_clear if country==3 & party!="LKR" & party!="BLAU", by(party) horizontal ///
					xlabel(0 "not at all clear" 1 " " 2 3 4 5 6 7 8 9 " " 10 "compl. clear") ytitle("") note(" ") xtitle(Clarity of GAL/TAN position) name(gr2a, replace) nodraw
			graph combine gr1a gr2a, rows(2) xcommon title("Clarity of position") name(pic1, replace) nodraw

			
	* plot dissent by German parties from CHES 2017 
		ciplot immigrate_dissent if country==3 & party!="LKR" & party!="BLAU", by(party) horizontal ///
				xlabel(0 "compl. united" 1 " " 2 3 4 5 6 7 8 9 " " 10 "extr. divided") ytitle("") note(" ") name(gr1b, replace) nodraw
		ciplot multicult_dissent if country==3 & party!="LKR" & party!="BLAU", by(party) horizontal ///
				xlabel(0 "compl. united" 1 " " 2 3 4 5 6 7 8 9 " " 10 "extr. divided") ytitle("") note(" ") name(gr2b, replace) nodraw
		graph combine gr1b gr2b, rows(2) xcommon title("Dissent within the party") name(pic2, replace) nodraw

		graph combine pic1 pic2, iscale(1) imargin(small) name(FigureA2, replace)


* FIGURE A3: plot salience by german parties from CHES 2017		
		ciplot lrecon_salience if country==3 & party != "LKR" & party != "BLAU", by(party) horizontal ///
				xlabel(0 "None" 1 2 3 4 5 6 7 8 9 10 "High") ytitle("") note(" ") xtitle(Salience of economic issues) name(gr3a, replace) nodraw

		egen cult_sal=rowmean(galtan_salience galtan_new_salience immigra_salience multicult_salience) if galtan_salience!=. & galtan_new_salience !=. & immigra_salience!=. & multicult_salience!=.
				label variable cult_sal "cultural salience (GALTAN, migration and multiculturalism)"

		ciplot cult_sal if country==3 & party != "LKR" & party != "BLAU", by(party) horizontal ///
				xlabel(0 "None" 1 2 3 4 5 6 7 8 9 " " 10 "High") ytitle("") note(" ") xtitle(Salience of cultural issues: GAL/TAN) name(gr3b, replace) nodraw
		ciplot immigra_salience if country==3 & party != "LKR" & party != "BLAU", by(party) horizontal ///
				xlabel(0 "None" 1 2 3 4 5 6 7 8 9 10 "High") ytitle("") note(" ") xtitle(Salience of immigration policy) name(gr3c, replace) nodraw		
	
		graph combine gr3a gr3b gr3c, rows(3) xcommon imargin(tiny) name(FigureA3, replace)